package cn.edu.mju.property.dao;
import cn.edu.mju.property.entity.User;

import java.util.List;

public interface UserDao {

    public List<User> findAll();
    public User longin(User loginUser);

    public boolean add(User user);

    boolean delSelected(String id);

    User findUser(String id);

    boolean updateUser(User user);

    int findTotalCount();

    List<User> findByPage(int start, int rows);

    /*
    * 登入方法
    * @parm LoginUser 只有用户名密码
    * @return user 包含用户全部数据
    * */

   /* public User login(User loginUser){
        User user = null;
        try {
            Connection conn =  JDBCUtil.getConnect();
            String sql = "select * from admin_user where username = ? and password = ?";
            PreparedStatement pstmt = conn.prepareStatement(sql);
            pstmt.setString(1,loginUser.getUsername());
            pstmt.setString(2,loginUser.getPassword());
            ResultSet rs = pstmt.executeQuery();
            if(rs.next()){
                user = new User();
                user.setId(rs.getInt("id"));
                user.setUsername(rs.getString("username"));
                user.setPassword(rs.getString("password"));
            }
            pstmt.close();
            conn.close();
        } catch (Exception e) {
            e.printStackTrace();
        }
        return user;
    }*/
}
